

% 函数用于指标正向化
% inputArg: 要正向化的指标序列
% transFun: 转换方法
%           "Inter2Max"
%           "Mid2Max"
%           "Min2Max"
% bestValue: 

function outputArg = transTargetType(inputArg,transFun,bestValue)

switch(transFun)
    % 区间型指标转换为极大值指标
    case "Inter2Max"
        inSize=size(inputArg);
        a=bestValue(1);
        b=bestValue(2);
        M=max([a-min(inputArg),max(inputArg)-b]);
        outputArg=zeros(inSize);
        for i = 1:inSize
            if inputArg(i)<a
                outputArg(i)=1-(a-inputArg(i))/M;
            elseif inputArg(i)>b
                outputArg(i)=1-(inputArg(i)-b)/M;
            else
                outputArg(i)=1;
            end
        end
    % 中间型指标转换为极大值指标
    case "Mid2Max"
        M=max(abs(inputArg-bestValue));
        outputArg=1-abs(inputArg-bestValue)/M;
    % 极小值指标转换为极大值指标
    case "Min2Max"
        outputArg=max(inputArg)-inputArg;

end